package com.duqc.designpattern.decorator;

/**
 * @ClassName EncryptionDecorator
 * @Description 装饰者模式(装饰抽象类)
 * @Author duqc
 * @Date 2021/5/11
 **/
public abstract class EncryptionDecorator extends EncryptionBase {

    /**
     * 定义一个父类的成员变量，用来存储其他装饰类，或者基础加密类
     */
    private final EncryptionBase encryptionBase;

    protected EncryptionDecorator(EncryptionBase encryptionBase) {
        this.encryptionBase = encryptionBase;
    }

    @Override
    public String encrypt(String string, String password) {
        return encryptionBase.encrypt(string, password);
    }
}
